package com.topgay.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.topgay.domain.FriendList;

@Repository
public class FriendListDAOImpl implements FriendListDAO {

	@Autowired
	private SqlSessionTemplate session;
	
	@Override
	public int insertFriendList(FriendList list) throws SQLException {
		return session.insert("friendList.insertFriendList", list);
	}

	@Override
	public int deleteFriendList(String myId, String friendId) throws SQLException {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("myId", myId);
		map.put("friendId", friendId);
		return session.delete("friendList.deleteFriendList", map);
	}

	@Override
	public List<FriendList> selectFriendList(String myId) throws SQLException {
		return session.selectList("friendList.selectFriendList", myId);
	}
	
	

}
